t = int(input())

for _ in range(t):
    n, k = map(int, input().strip().split())
    a = list(map(int, input().strip().split()))
    a = [10**el for el in a]
    notes = 0
    total = 0
    for i in range(len(a)-1):
        b = a[i]
        c = a[i+1]
        new_burles = c - b
        new_notes = new_burles // b

        if(notes + new_notes > k+1):
            new_notes = k-notes+1
            notes = k+1
            new_burles = new_notes * b
            total += new_burles
            break
        else:
            notes += new_notes
            total += new_burles
    if(notes < k+1):
        total += (k-notes+1)*a[len(a)-1]
    print(total)
